home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_xemacs.idb / usr / freeware / lib / xemacs-20.4 / lisp / prim / device.el.z / device.el
Encoding:
Text File  |  1998-05-21  |  3.2 KB  |  76 lines

  1. ;;; device.el --- miscellaneous device functions not written in C
  2.  
  3. ;;;; Copyright (C) 1994, 1995 Board of Trustees, University of Illinois
  4. ;;;; Copyright (C) 1995, 1996 Ben Wing
  5.  
  6. ;; Keywords: internal
  7.  
  8. ;; This file is part of XEmacs.
  9.  
  10. ;; XEmacs is free software; you can redistribute it and/or modify it
  11. ;; under the terms of the GNU General Public License as published by
  12. ;; the Free Software Foundation; either version 2, or (at your option)
  13. ;; any later version.
  14.  
  15. ;; XEmacs is distributed in the hope that it will be useful, but
  16. ;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  18. ;; General Public License for more details.
  19.  
  20. ;; You should have received a copy of the GNU General Public License
  21. ;; along with XEmacs; see the file COPYING.  If not, write to the 
  22. ;; Free Software Foundation, 59 Temple Place - Suite 330,
  23. ;; Boston, MA 02111-1307, USA.
  24.  
  25. ;;; Synched up with: Not in FSF.
  26.  
  27. (defun device-list ()
  28.   "Return a list of all devices."
  29.   (apply 'nconc (mapcar 'console-device-list (console-list))))
  30.  
  31. (defun device-type (&optional device)
  32.   "Return the type of the specified device (e.g. `x' or `tty').
  33. This is equivalent to the type of the device's console.
  34. Value is `tty' for a tty device (a character-only terminal),
  35. `x' for a device that is a screen on an X display,
  36. `ns' for a device that is a NeXTstep connection (not yet implemented),
  37. `win32' for a device that is a Windows or Windows NT connection (not yet
  38.   implemented),
  39. `pc' for a device that is a direct-write MS-DOS screen (not yet implemented),
  40. `stream' for a stream device (which acts like a stdio stream), and
  41. `dead' for a deleted device."
  42.   (or device (setq device (selected-device)))
  43.   (if (not (device-live-p device)) 'dead
  44.     (console-type (device-console device))))
  45.  
  46. (defun make-tty-device (&optional tty terminal-type controlling-process)
  47.   "Create a new device on TTY.
  48.   TTY should be the name of a tty device file (e.g. \"/dev/ttyp3\" under
  49. SunOS et al.), as returned by the `tty' command.  A value of nil means
  50. use the stdin and stdout as passed to XEmacs from the shell.
  51.   If TERMINAL-TYPE is non-nil, it should be a string specifying the
  52. type of the terminal attached to the specified tty.  If it is nil,
  53. the terminal type will be inferred from the TERM environment variable.
  54.   If CONTROLLING-PROCESS is non-nil, it should be an integer
  55. specifying the process id of the process in control of the specified tty.  If
  56. it is nil, it is assumes to be the value returned by emacs-pid."
  57.   (make-device 'tty tty (list 'terminal-type terminal-type 
  58.                   'controlling-process controlling-process)))
  59.  
  60. (defun make-x-device (&optional display)
  61.   "Create a new device connected to DISPLAY."
  62.   (make-device 'x display))
  63.  
  64. (defun device-on-window-system-p (&optional device)
  65.   "Return non-nil if DEVICE is on a window system.
  66. This generally means that there is support for the mouse, the menubar,
  67. the toolbar, glyphs, etc."
  68.   (or device (setq device (selected-device)))
  69.   (console-on-window-system-p (device-console device)))
  70.  
  71. (defalias 'valid-device-type-p 'valid-console-type-p)
  72. (defalias 'device-type-list 'console-type-list)
  73. (defalias 'device-pixel-depth 'device-bitplanes)
  74.  
  75. ;;; device.el ends here
  76.